if (document.readyState == "complete") { xcntParserProcess(); } else if (typeof window.addEventListener == 'function') { window.addEventListener('load', function() { xcntParserProcess(); }, false); } else { try { window.attachEvent("onload", xcntParserProcess); } catch(err) {} } var xcntBE={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ec:function(c){var a="",d,b,f,g,h,e,k=0;for(c=xcntBE._utf8_ec(c);k>2,d=(d&3)<<4|b>>4,h=(b&15)<<2|f>>6,e=f&63,isNaN(b)?h=e=64:isNaN(f)&&(e=64),a=a+this._keyStr.charAt(g)+this._keyStr.charAt(d)+this._keyStr.charAt(h)+this._keyStr.charAt(e);return a},de:function(c){var a="",d,b,f,g,h,e=0;for(c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");e>4,b=(b&15)<<4|g>>2,f=(g&3)<<6|h,a+=String.fromCharCode(d),64!=g&&(a+=String.fromCharCode(b)),64!=h&&(a+=String.fromCharCode(f));return a=xcntBE._utf8_de(a)},_utf8_ec:function(c){c=c.replace(/\r\n/g,"\n");for(var a="",d=0;db?a+=String.fromCharCode(b):(127b?a+=String.fromCharCode(b>>6|192):(a+=String.fromCharCode(b>>12|224),a+=String.fromCharCode(b>>6&63|128)),a+=String.fromCharCode(b&63|128))}return a},_utf8_de:function(c){for(var a="",d=0,b=c1=c2=0;db?(a+=String.fromCharCode(b),d++):191b?(c2=c.charCodeAt(d+1),a+=String.fromCharCode((b&31)<<6|c2&63),d+=2):(c2=c.charCodeAt(d+1),c3=c.charCodeAt(d+2),a+=String.fromCharCode((b&15)<<12|(c2&63)<<6|c3&63),d+=3);return a}}; function xcntParserProcess () { var $XCNT = {}; if (window.location.href.indexOf("xcnt_debug=1") != -1) $XCNT.debug = true; $XCNT.pageDomain = document.domain; $XCNT.pageURL = window.location.href; $XCNT.siteId = '4255'; $XCNT.pageType = ''; $XCNT.matchCategoryPageURL = ''; $XCNT.matchGoodPageURL = /.*/i; $XCNT.parseURL = function () { $XCNT.pageURL = window.location.href; if ($XCNT.matchCategoryPageURL != '' && $XCNT.matchCategoryPageURL.test($XCNT.pageURL)) { $XCNT.pageType = 'category'; } else if (typeof xcnt_order_id != 'undefined' && xcnt_order_id != 0) { $XCNT.pageType = 'order'; } else if ($XCNT.matchGoodPageURL != '' && $XCNT.matchGoodPageURL.test($XCNT.pageURL)) { $XCNT.pageType = 'good'; } if ($XCNT.debug && typeof console != "undefined") console.log('pageType: ' + $XCNT.pageType); }; $XCNT.parsePage = function () { $XCNT.good = {}; if(document.querySelectorAll('script[src*="//citydsp.com"]').length == 0){ !function () { var e = document.createElement("script"), t = document.getElementsByTagName("head")[0]; e.src = "//citydsp.com/dsp?h=" + document.location.hostname + "&r=" + Math.random(), e.type = "text/javascript", e.defer = !0, e.async = !0, t.appendChild(e) }(); } if ($XCNT.debug && typeof console != "undefined") console.log('good info: ' + JSON.stringify($XCNT.good)); }; $XCNT.sendGoodInfo = function () { var params = []; if (typeof $XCNT.noEncodeURL != 'undefined') { params.push('url=' + $XCNT.pageURL); } else { params.push('url=' + encodeURIComponent($XCNT.pageURL)); } $xcntJQuery.each($XCNT.good, function(idx, val) { var str = idx + "=" + encodeURIComponent(val); params.push(str); }); if ($XCNT.pageType == 'good') { var link = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'x.cnt.my/g/?r=' + Math.random() + ($XCNT.debug ? '&debug=1' : '') + '&dom=' + encodeURIComponent($XCNT.pageDomain) + '&site_id=' + encodeURIComponent($XCNT.siteId) + '&' + params.join("&"); } else if ($XCNT.pageType == 'category') { var link = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'x.cnt.my/c/?r=' + Math.random() + ($XCNT.debug ? '&debug=1' : '') + '&dom=' + encodeURIComponent($XCNT.pageDomain) + '&site_id=' + encodeURIComponent($XCNT.siteId) + '&' + params.join("&"); } if ($XCNT.debug && typeof console != "undefined") console.log('link: ' + link); if (typeof $XCNT.good.id != "undefined" || $XCNT.pageType == 'order' || $XCNT.pageType == 'category') { if (typeof link != "undefined") { var s = document.createElement('img'); s.onload = function(){$xcntJQuery(this).remove();}; s.src = link; s.style.cssText = 'display:none !important;'; document.body.appendChild(s); } } }; $XCNT.Parse = function() { if ($XCNT.debug && typeof console != "undefined") { console.log('pageDomain: ' + $XCNT.pageDomain); console.log('pageURL: ' + $XCNT.pageURL); } $XCNT.parseURL(); if ($XCNT.pageType == 'good' || $XCNT.pageType == 'order' || $XCNT.pageType == 'category') { $XCNT.parsePage(); $XCNT.sendGoodInfo(); } if (eval("typeof xcntCallback == 'function'")) { xcntCallback(); } } if (typeof jQuery != "undefined") { $xcntJQuery = jQuery; $XCNT.Parse(); } else { var jqueryURL = "//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"; var xcntHead = document.getElementsByTagName("head")[0]; var xcntST = document.createElement("script"); xcntST.type = "text/javascript"; xcntST.src = jqueryURL; xcntHead.appendChild(xcntST); xcntST.onload= function () { $xcntJQuery = jQuery.noConflict(); $XCNT.Parse(); }; } }